using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class RewardBase : MonoBehaviour
{
    //特效
    public GameObject getEffct;
    public virtual void RewardLifeCycle()
    {
        if (getEffct != null)
        {
            //播放拾取特效
            GameObject eff =
            Instantiate(getEffct, transform.position, transform.rotation);
            //控制特效声音
            AudioSource audio = eff.GetComponent<AudioSource>();
            if (audio != null)
            {
                audio.mute = !GameDataMgr.Instance.soundData.isOnSoundEffect;
                audio.volume = GameDataMgr.Instance.soundData.soundEffectValue;
                Destroy(this.gameObject);
            }
            else
            {
                Debug.Log(gameObject.name + "的audio为空");
            }
        }
        else
        {
            Debug.Log(gameObject.name + "的getEffct为空");
        }
    }

}
